package com.yilin.tms.order.mapper.transit;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yilin.tms.core.application.PageData;
import com.yilin.tms.core.entity.order.transit.TransitOrder;
import com.yilin.tms.core.entity.user.account.Account;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 运单Mapper
 *
 * @author zhangjinyuan
 * @date 2022/10/29
 */
@Mapper
@Repository
public interface TransitOrderMapper extends BaseMapper<TransitOrder> {
    /**
     * 获取运单分页
     */
    PageData<TransitOrder> getTransitOrderPage(@Param("page") PageData<TransitOrder> pageData,
                                               @Param("loginUser") Account loginUser,
                                               @Param("query") TransitOrder query,
                                               @Param("statuses") List<Integer> statuses);

    List<TransitOrder> getGatherTransitOrderList(@Param("loginUser") Account loginUser,
                                                 @Param("gatherOrderIdList") List<String> gatherOrderIdList,
                                                 @Param("shipperOrganizeId")String shipperOrganizeId,
                                                 @Param("robOrganizeId")String robOrganizeId,
                                                 @Param("receiptTimeRangeStart")String receiptTimeRangeStart,
                                                 @Param("receiptTimeRangEnd")String receiptTimeRangEnd,
                                                 @Param("matching")Boolean matching,
                                                 @Param("includedTax")Boolean includedTax,
                                                 @Param("transitTruckNo")String transitTruckNo
                                                 );

    List<Map<String,Object>> getGatherShipperDropList(@Param("loginUser") Account loginUser);

    List<Map<String,Object>> getGatherTruckerDropList(@Param("loginUser") Account loginUser);

    List<TransitOrder> getBillTransitOrderList(@Param("loginUser") Account loginUser,
                                               @Param("robOrganizeId")String robOrganizeId,
                                               @Param("timeRangeStart")String timeRangeStart,
                                               @Param("timeRangeEnd")String timeRangeEnd
                                               );

    /**
     * 获取送达超过七天未评价的运单
     */
    List<TransitOrder> getOrderByComplete(@Param("date")String date);

    List<Map<String, Object>> getTradingTrendData(@Param("organizeId")String organizeId);
}
